package com.moxiao.yfjh.module.blind.dal.mysql.privilege;

import com.moxiao.yfjh.module.blind.controller.admin.privilege.vo.MemberPrivilegeExportReqVO;
import com.moxiao.yfjh.module.blind.controller.admin.privilege.vo.MemberPrivilegePageReqVO;
import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import com.moxiao.yfjh.module.blind.dal.dataobject.privilege.MemberPrivilegeDO;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.blind.controller.admin.privilege.vo.*;

/**
 * 相亲会员等级特权 Mapper
 *
 * @author mx
 */
@Mapper
public interface MemberPrivilegeMapper extends BaseMapperX<MemberPrivilegeDO> {

    default PageResult<MemberPrivilegeDO> selectPage(MemberPrivilegePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberPrivilegeDO>()
                .eqIfPresent(MemberPrivilegeDO::getLevelId, reqVO.getLevelId())
                .likeIfPresent(MemberPrivilegeDO::getPrivilegeName, reqVO.getPrivilegeName())
                .eqIfPresent(MemberPrivilegeDO::getPrivilegeNum, reqVO.getPrivilegeNum())
                .eqIfPresent(MemberPrivilegeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberPrivilegeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberPrivilegeDO::getId));
    }

    default List<MemberPrivilegeDO> selectList(MemberPrivilegeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MemberPrivilegeDO>()
                .eqIfPresent(MemberPrivilegeDO::getLevelId, reqVO.getLevelId())
                .likeIfPresent(MemberPrivilegeDO::getPrivilegeName, reqVO.getPrivilegeName())
                .eqIfPresent(MemberPrivilegeDO::getPrivilegeNum, reqVO.getPrivilegeNum())
                .eqIfPresent(MemberPrivilegeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberPrivilegeDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(MemberPrivilegeDO::getId));
    }

}
